﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using UIT.Converters;

namespace UIT.Style
{
	[TypeConverter(typeof(ColorConverter))]
	public struct Color : IEquatable<Color>
	{
		private uint value;

		public Color(uint argb)
		{
			value = argb;
		}

		public bool IsEmpty { get { return Value == Colors.Empty.Value; } }

		public byte Alpha { get { return (byte)(value >> 24); } }
		public byte Red { get { return (byte)((value << 8) >> 24); } }
		public byte Green { get { return (byte)((value << 16) >> 24); } }
		public byte Blue { get { return (byte)((value << 24) >> 24); } }

		public uint Value { get { return value; } }

		#region IEquatable<Color> Members

		public bool Equals(Color other)
		{
			return value == other.value;
		}

		#endregion
	}

	public static class Colors
	{
		public readonly static Color Black = new Color(0xFF000000);
		public readonly static Color Red = new Color(0xFFFF0000);
		public readonly static Color Green = new Color(0xFF00FF00);
		public readonly static Color Blue = new Color(0xFF0000FF);
		public readonly static Color White = new Color(0xFFFFFFFF);
		public readonly static Color Transparent = new Color(0x00FFFFFF);
		public readonly static Color Empty = new Color(0x00000000);
	}
}
